/*		Filename: 	public.h
 *		Author:		彭望
 *		Date:		2012-01-09
 *		Use:		定义各个部分公共的文件
 */
#ifndef PUBLIC_H
#define PUBLIC_H

#include <string>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>

#include "message.pb.h"
using namespace std;
using boost::enable_shared_from_this;
using boost::shared_ptr;
using boost::bind;
/*
 *		Date:		2012-01-09
 *		Use:		定义通讯协议中的命令字
 */
enum RequestCommand
{
	LOGIN				=			10000,
	LOGOUT				=			10001,
	
	QUERY_ALL			=			20000,
	QUERY_BALANCE		=			20001,
	QUERY_CONSUMPTION	=			20002,
	QUERY_LOGINTIME		=			20003,
};

/*
 *		Date:		2012-01-09
 *		Use:		定义通讯协议中的返回值
 */
enum ResponseCode
{
	ERR_OK					=			10000,
	ERR_INVALID_COMMAND		=			10001,
	ERR_INVALID_ARG			=			10002,
	ERR_USER_NOT_FOUND		=			10003,
	ERR_PASSWORD_ERROR		= 			10004,
	ERR_BALANCE_NOT_ENOUGH	=			10005,
	ERR_NOT_PERMITTED		=			10006,

	ERR_SERVER_ERROR		=			20000
};


/*
 *		Date:		2012-01-10
 *		Use:		定义通讯协议中的返回值
 */
enum RetCode_t
{
		RET_OK				=			0,
		RET_NOT_FOUND		=			-10000,
		RET_INVALID_ARG		=			-10001,
		RET_INIT_ERROR		=			-10002,

		RET_DB_ERROR 		=			-20000,
		RET_OPEN_DB_ERROR	=			-20001,
		RET_QUERY_DB_ERROR  =			-20002,
		RET_INSERT_DB_ERROR = 			-20003
};

/*
 *		Date:		2012-01-09
 *		Use:		定义登陆所需的信息
 */
struct CLoginInfo
{
	string username;
	string password;
};

/*
 *		Date:		2012-01-09
 *		Use:		定义查询服务所需的信息
 */
struct CQueryInfo
{
	unsigned int uiCmd;
	string strCardNum;
	string strArg;
};




#endif
